home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / PhalanxXVIII / README < prev    next >
Text File  |  1998-09-06  |  20KB  |  317 lines

  1. Phalanx is a chess playing program
  2. Copyright (c) 1997, 1998 Dusan Dobes
  3.  
  4. LICENSE AND WARRANTY
  5. - Phalanx is free software; you can redistribute it and/or modify it
  6.   under the terms of the GNU General Public License as published by
  7.   the Free Software Foundation; either version 2, or (at your option)
  8.   any later version.
  9. - Phalanx is distributed in the hope that it will be useful, but
  10.   WITHOUT ANY WARRANTY; without even the implied warranty of
  11.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.   GNU General Public License for more details.
  13. - You should have received a copy of the GNU General Public License
  14.   along with Phalanx; see the file COPYING.  If not, write to
  15.   the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
  16.   MA  02111-1307, USA.
  17.  
  18. WHERE TO GET PHALANX
  19.   ftp://sunsite.unc.edu/pub/Linux/games/strategy/    (and mirrors)
  20.   ftp://ftp.math.muni.cz/pub/math/people/Dobes/
  21.  
  22. COMPILING, PORTABILITY
  23.   Compiling is simple, at least under Linux. Just type `make'.  Phalanx is
  24.   developed under GNU C, GNU Debugger, and GNU Make.  It's probably possible to
  25.   compile it on many different platforms, but today i have no oportunity to try
  26.   it on any other platform than Linux and HP-UX.  If your system does not
  27.   support GNU exensions (e.g. long options), remove '-DGNUFUN' from DEFINES in
  28.   makefile.  If you have incompatible 'make', try this:
  29.   $ cat *.c > allphalanx.c; cc -O allphalanx.c -o phalanx
  30.  
  31. INTERFACE, COMMAND LINE OPTIONS
  32.   Phalanx is xboard compatible.  Running with xboard: 'xboard -fcp phalanx'.
  33.   Note that permanent brain (pondering) is off by default.  Newer versions of
  34.   xboard set it on with the 'hard' command.  If this does not work, try
  35.   'xboard -fcp "phalanx -p+"' or (for <4.0.0 versions of xboard) change your
  36.   initString (see Xboard documentation for details).  It's better to stop
  37.   permanent brain in both programs, when playing Phalanx against another
  38.   program on a machine with one CPU.
  39.   It's also possible to run phalanx without xboard. Do "phalanx -h" to get
  40.   a list of command line options. One important command of phalanx's ASCII
  41.   interface is "help".
  42.  
  43. MORE ABOUT INTERFACE
  44.   I'm trying to write an interface that fits following three requirements:
  45.   - Xboard compatibility.  For best results, get the latest version of Xboard.
  46.   - shell-like interface that allows running commands in a batch. It's very
  47.     useful for testing. Example: look into the file test.fin. It's a set
  48.     of chess problems and solutions. You can simply send this file to
  49.     Phalanx's stdin:
  50.     $ phalanx -c+ -o- -b- -f10 < test.fin | tee result
  51.     ( Where: -c+ .... use cpu time
  52.              -o- .... don't use polling input
  53.              -b- .... no opening book
  54.              -f10 ... fixed time 10 seconds per move )
  55.     Watch how it works.
  56.   - Acceptable ASCII interface.
  57.  
  58. OPENING BOOK
  59.   From version VI, there are two book files - primary (pbook.phalanx), and
  60.   secondary (sbook.phalanx).  You can specify book directories via command line
  61.   (-P, -S) or use environment variables PHALANXPBOOKDIR and PHALANXSBOOKDIR.
  62.   Otherwise Phalanx tries to find its book files in current directory
  63.   (./book.phalanx, ./sbook.phalanx) and finally in compiled-in directory
  64.   (/usr/local/lib/phalanx).  You can change the compiled-in directory in
  65.   makefile.
  66.   - pbook.phalanx is 'hand'-written, text book.  One line per position, sorted.
  67.     This time, it's bigger than really needed, because it was the only book
  68.     file till version V.  The size will be smaller and the line format might
  69.     change to EPD+SAN in future.
  70.   - sbook.phalanx is binary book, generated from large PGN files.  Six bytes
  71.     per move (4 hash key, 2 move).  You can generate your own sbook.phalanx
  72.     with 'phalanx bcreate', like this:
  73.     $ ./phalanx bcreate < manyGMgames.pgn
  74.     or:
  75.     $ ./phalanx bcreate 1250000 < manyGMgames.pgn
  76.     ( where 1250000 is internal buffer size in cells.  One cell takes 12 bytes.
  77.       Bigger is better, only if it's too big a part of the buffer is unused.
  78.       E.g. 1250000 is enough to parse Crafty's 'medium' book source - 29MB. )
  79.   A position is first searched in pbook.phalanx.  Only if it's not found there,
  80.   sbook.phalanx is searched.
  81.  
  82. INSIDE THE MACHINE
  83.   Phalanx uses (traditional) 10x12 board implementation.  There are three
  84.   often used board implementations: "8x8" (GNU Chess), "bitboard" (Crafty),
  85.   and "10x12" (Nimzo, Phalanx).  In short, "10x12" is easy to implement and
  86.   the code and basic data structures are small ( == fast on PC).  The engine
  87.   uses many well known techniques: PVS (principal variation search),
  88.   transposition/killer table, static-eval cache, history killers, SEE (static
  89.   exchange evaluator), null move pruning, forward pruning, internal iterative
  90.   deepening, chess-specific extensions.
  91.  
  92. AUTHOR
  93.   Dusan Dobes, dobes@math.muni.cz
  94.  
  95.  
  96. HISTORY
  97. The rest of this file is history of Phalanx.
  98.  
  99. I         First version to play a legitimate game, it finally knows all rules.
  100. 19970304  I spent a lot of time on tuning transposition table code and
  101.           extensions. The program scores 78% at large Reinfeld's test set, 10 s
  102.           per move, on 486+/150.
  103.  
  104. II        Two killer heuristics added: well known history killers (modified)
  105. 199704??  and `reaction' killers (the killer is connected to the previous enemy
  106.           move). The tree search is faster, especially at `quiet' positions.
  107.           Hashtable presearch. Modified hashentry replacement strategy. Better
  108.           evaluation function, it now knows more about passed pawns, the
  109.           endgame play is much stronger. Fixed bug at 7-th row pawn push
  110.           extension routine. Faster output - using sprintf() to prepare the
  111.           output and then only one printf. New command line options: -t, -T to
  112.           set the hashtable size.
  113.  
  114. III       Permanent brain (pondering).  King safety evaluation.  Hung pieces
  115. 19970529  static evaluation.  Null move pruning.  Forward pruning.  Better time
  116.           heuristics - forced moves are played quickly.  New cmd-line options:
  117.           -f, -x, -p, -s.
  118.  
  119. IV        New option -c to determine whether to use cpu or real time.  The
  120. 19970721  internal timing resolution changed to 1/100 of a second.  Xboard
  121.           compatible editing position.  Removed en-passant capture from
  122.           quiescence search.  Changes in static-eval function.  Piece list
  123.           implemented - speedup is between 0 and 20%; more in endgame.  Pinned
  124.           pieces static evaluation.  Better evaluation of weak pawns.  Trapped
  125.           bishop and knight evaluation.  Bugfix at extending check evasions.
  126.           Bugfix: development bonus was computed but not added to total
  127.           evaluation.  Output change: '!' means turn, '!!' means value out of
  128.           window.
  129.  
  130. V         Mostly interface changes, no big improvement in playing strength.
  131. 19970803  Xboard compatibility fixes: 'post' is no more switch, new command
  132.           'remove'.  Fixed command 'level': 'level 0 5 0' (five minutes per
  133.           game) should work, also increment (ICS) levels ('level 0 2 12').
  134.           Increment can be given at command line.  New option -o (polling
  135.           input) - when running tests, phalanx needs -o-.  New feature of
  136.           autotesting: all incorrect results are written into file
  137.           'notfound.fin'.  Small output changes for better compatibility with
  138.           xboard 3.6.2.  Eliminated some bad turns in evaluation.  Better king
  139.           safety evaluation - counting safe checks available.
  140.  
  141. VI        Fixed small efficiency bug in evaluate.c.  Improved time heuristics
  142. 19970915  for increment (ICS) levels.  Optimized hashing - about 5% overall
  143.           speedup.  Fixed bug in ptime().  User is now allowed to continue play
  144.           even if the position is drawn by 3-rep., material, or 50 moves rule.
  145.           Fixed bug - Draw requests are now always ignored, not always accepted
  146.           :-).  Xboard-compatible 'Illegal move' message.  Binary opening book,
  147.           created from PGN by bcreate.  This distribution is bigger than any
  148.           previous because it contains a small example of binary book
  149.           ('sbook.phalanx', 174kB, 29634 moves).  SAN input accepted.  Static
  150.           evaluation now better understands middlegame positions without
  151.           castling.  Added pre-computed tables into static evaluation -> about
  152.           5% speed improvement.  'Show thinking' mode now shows also a list of
  153.           book moves if there's a book entry.  I have played a match with
  154.           previous version (64 games, 2 minutes, increment 12 seconds, on
  155.           a 486+/150, via xboard, no pondering), new version wins 38.5-25.5.
  156.  
  157. VII       Courtesy of Pavel Janik ml., new command 'fen'.  Bugfix in command
  158. 19971022  line parser, 'phalanx 0 2 12' now works.  Better time controls: added
  159.           hard time limit to avoid being flagged.  Pondering bugfix: Phalanx
  160.           was pondering O-O, but opponent played O-O-O; the move check was
  161.           incorrect and Phalanx thought that O-O was played; this resulted in
  162.           'Illegal move' message few moves later.  More pondering safety: the
  163.           move to be pondered is now checked for legality, before this fix it
  164.           was simply taken from PV (if present), but PV is not always 100%
  165.           correct.  More PV safety: search cannot be interrupted during the
  166.           first iteration, the abort is delayed until the first iteration is
  167.           finished.  New options: -r <resign value>, -b <+/-> to set opening
  168.           book on/off.  New commands hard/easy to set pondering on/off.
  169.           Optimized do_move(): 3% speedup in test positions.  Search
  170.           optimization: null move is not played if the value in hash table
  171.           entry is too low.  Output bugfix: output is now readable even at long
  172.           time searches.  SEE (Static Exchange Evaluator) and more pruning in
  173.           quiescence search.  RoboFICS compatible commands 'white' and 'black'.
  174.           Routine for evaluating pawn endgames.  New extension trick that helps
  175.           in some horizon-effect type positions, it's based on measuring
  176.           difference between current score and null move result; if current
  177.           score is much better, the side to move must be under threat and the
  178.           line is extended, similar trick is also in gnuchess.
  179.  
  180. VIII      Fixed bug in search(): eliminated useless re-searches -> about 3%
  181. 19971103  speed improvement.  Noise level is now in centiseconds, not in nodes.
  182.           Improved horizon-effect extensions.  endgame.c: new endgame
  183.           knowledge, mostly for endgames with minor pieces and pawns: knight
  184.           and bishop mating, knight+knight (draw), minor vs. minor (draw),
  185.           minor vs. pawn (draw, but still needs some work, sometimes a pawn
  186.           wins against a knight), onepawn() as a special case of pawns(), bad
  187.           bishop (bishop + rook pawn), basics for R+P vs. R, bishops with
  188.           opposite colors (this is often drawish ending).  New penalty for
  189.           moving castling-side pawns in middlegame.
  190.  
  191. IX        Function smove() is now used in both binary book and hashing code, it
  192. 19971205  is cleaner and easier to read, the binary is smaller with this.
  193.           Bugfix: Phalanx now does not ponder move that leads into a terminal
  194.           position (checkmate, stalemate), this fixes some unexpected quits
  195.           (I hope all of them).  Added more limits to horizon-effect extension
  196.           trigger - there was so many extensions, that version VIII was
  197.           actually weaker than previous versions, because of lower nominal
  198.           search depth; these extensions are now used only for major threats.
  199.           Static eval cache entry is now packed into 4 bytes instead of 8 ->
  200.           the cache eats only 256K (512K before this).
  201.  
  202. X         Bugfix in static evaluation of trapped knight at [AH]7.  Better
  203. 19980108  evaluation of trapped bishop ([AH]7) and knight ([AH][87]), now it's
  204.           using the static exchange evaluator.  Time allocation: alloc more
  205.           time (+1/8) if pondering is on.  Better understanding of 'trade-down'
  206.           bonus - if there are no pawns, you often need a rook more to win the
  207.           game, a minor piece is not enough.  Shallower extensions resulting in
  208.           greater average search depth.  Easy levels: use new command line
  209.           option -e <1...100> to select an easy level; 1 is the strongest and
  210.           100 is the easiest one, Phalanx tries to make human-like blunders.
  211.           Minor changes in resigning.  Clean up in pbook.phalanx, deleted over
  212.           100 positions.  Killer heuristics now uses the SEE.  Bugfix in
  213.           endgame.c: trade bonus did not work for kings and pawns endgames.
  214.           Simple learning, can be activated by -l+ option; it is off by
  215.           default, because it's very experimental version.  New version wins
  216.           engine-engine match with version IX 23:17 (tc 2, inc 8, 486+/150,
  217.           no learning, no pondering).
  218.  
  219. XI        Courtesy of Milan Zamazal: long options and user-friendly handling of
  220. 19980125  book files - you can now use environment variables or command line
  221.           options.  Bugfix in trade bonus: endgame KQ-KBPP was evaluated only
  222.           about +1.10, but the stronger side is winnig here even without pawns,
  223.           now it's >+3.00 and Phalanx can solve this Dufrense&Mieses study:
  224.           8/3Np3/7P/1p3P2/1k6/5K2/1b6/8/w Pf5f6.  Deeper overall extensions,
  225.           +10% of ply.  More check evasion extensions.  Wider window for 'lazy
  226.           evaluation', search is now slower but stable.  Minor fixes in forward
  227.           and null move pruning.  Zero-width search modified for root moves,
  228.           actually it's no more zero-width; this eliminates some 'blind turns'
  229.           (a move is evaluated as >=(Alpha+1), but the engine cannot prove it
  230.           in re-search in full [Alpha,Beta] window).  Minor changes in static
  231.           evaluation.  Bugfix in time allocation of increment levels.  Changed
  232.           time heuristics to use more time.
  233.  
  234. XII       More pruning in quiescence search: moves that have little chance to
  235. 19980301  return the value over alpha are not generated.  Permanent brain is
  236.           now really 'permanent', if there is no move to ponder in the PV,
  237.           Phalanx uses short search to pick a move and ponders it.  Bugfix:
  238.           occasional zero division at very fast time controls, like 10s/game.
  239.           Some puts() replaced with printf(), puts() is buggy in my gcc (2.7.2)
  240.           and causes sigsegv when interrupted and called again during the
  241.           interrupt.  Optimized null move, this speeds up the engine.  Easy
  242.           levels now use nodes instead of centiseconds for measuring time, the
  243.           playing strength of easy levels does not depend on cpu power and
  244.           cpu load.  Resigning now works with RoboFics (via 'tellics resign').
  245.           Updated FSF address in docs.
  246.  
  247. XIII      Lots of 'char' and 'short' replaced with 'int' -> speedup on iX86
  248. 19980316  chips (about 10% on my 486, probably more on P6).  Bugfix at 'edit'
  249.           command, edit was broken for positions with black to move.  New
  250.           command line option 'bench', 'phalanx bench' runs a 5 cpu-minutes
  251.           benchmark and reports nodes per second.  Added some interesting lines
  252.           into the opening book.  Dynamic draw score, it's set to -20 by
  253.           default.  New command 'rating <phalanx rating> <opponent rating>' to
  254.           adjust the dynamic draw score, Phalanx tries to avoid draw with
  255.           weaker opponents, minimal draw score is -20, maximal +20.
  256.  
  257. XIV       Dynamic draw score did not work for stalemate, now fixed.  Major bug
  258. 19980416  fixed at resigning: if resigning was on, phalanx resigned almost any
  259.           game after few moves, this was broken from previous version.
  260.           Simplified computing bounds for lazy evaluation, this was too
  261.           complicated and slow.  Higher material limit for evaluating position
  262.           as endgame.  Deeper extensions, +0.1 ply.  Improved move ordering at
  263.           root search.  Minor optimizations.  More variability in opening book.
  264.           Disabled scout search near leafs.  Bugfix: type of Nodes changed to
  265.           'long long' (64 bits on Intel[3456]86), 32-bit integer was not long
  266.           enough for >24 hour runs.  Bugfix: option -P did not work, now fixed.
  267.           Added startup messages that show full path of all open files.
  268.  
  269. XV        Internal iterative deepening.  Cleaned pbook.phalanx.  New "Pc2-c4"
  270. 19980614  code to encourage playing c4 (c5 as black) in closed positions where
  271.           e4 (e5) is not possible.  Bugfix at computing total material on the
  272.           board, the variable was sometimes overwritten with unexact value.
  273.           New xboard compatible commands 'bk' and 'analyze'.  'bk' shows all
  274.           book moves.  'analyze' starts analysis mode.  Bugfix in bcreate.c: no
  275.           games on stdin caused segmentation fault.  GNU extensions (long
  276.           options and snprintf) are now used only if GNUFUN is defined
  277.           (-DGNUFUN in makefile).  New endgame knowledge: KNP vs. K is
  278.           sometimes draw.  Small changes in static evaluation.  SIGINT is
  279.           ignored in polling input mode.  Time information in post lines is
  280.           shown in centiseconds instead of seconds to follow current draft of
  281.           xboard chess engine communication protocol.
  282.  
  283. XVI       Bugfix in analyze mode: there is no extra character after the search
  284. 19980630  depth number in post lines - xboard understands that time info is in
  285.           centiseconds, not in seconds.  Bugfix in null move pruning: the side
  286.           that is trying its second move in row must have at least one legal
  287.           move, this caused segmentation fault if there was none.  Command
  288.           'hard' does not set pondering on in easy levels.  Bugfix at parsing
  289.           SAN moves, nc3 was (possibly) interpreted as Pc2-c3.  Command 'level'
  290.           accepts time in mm:ss form, for example 'level 0 2:30 12'.  Bugfix in
  291.           kings+pawns endgames - penalty for pawns on one file (doubled) worked
  292.           as penalty for pawns on one row.  Improved kings+pawns endgames
  293.           static evaluation.  New command 'xboard' sets xboard compatible mode.
  294.  
  295. XVII      More variability in pbook.phalanx.  Better sbook.phalanx, generated
  296. 19980804  from wall.pgn.  Changed (and fixed) extensions for check evasions and
  297.           passed pawn pushes.  Changed evaluation of passed pawns.  phalanx and
  298.           bcreate integrated into one binary, most of the code was common
  299.           anyway; book can be created via 'phalanx bcreate' instead of just
  300.           'bcreate'.  Bigger limit for count of [position,move] in bcreate
  301.           code, the counter has 32 bits instead of 16.  Performance bugfix in
  302.           null move pruning.
  303.  
  304. XVIII     Bugfix in the static exchange evaluator - it let kings slide
  305. 19980906  horizontally.  New styling of board in command "bd"/"d".  New command
  306.           in edit mode: 's' to switch side to move.  Modified look of edit
  307.           mode.  Modifications in static evaluation: bishop pair needs
  308.           mobility; queen has 'king distance' bonus only if it's on a safe
  309.           square; simpler rook evaluations - smaller bonuses; forpost (outpost)
  310.           pawn gets more bonus for # of pieces defending it (Aaron Nimzowitsch,
  311.           "Mein System"); bigger bonus for protected or connected passed pawns.
  312.           Modified threat extensions - only mate threats are extended.  Bugfix
  313.           in analysis mode: PV is computed (and shown) even if there is only
  314.           one legal move.  New feature of command 'level' - 'level N' sets
  315.           level to N seconds fixed time per move.  Better pbook.phalanx.
  316.  
  317.